﻿<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    protected void OnLoginCommand(object sender, CommandEventArgs e)
    {
        if (Membership.ValidateUser(txtUser.Text, txtPwd.Text))
        {
            if (cbAutoLogin.Checked)
                FormsAuthentication.SetAuthCookie(txtUser.Text, true);
        }
        else
           Dialog.ShowModalDialog(this, "Login Fail", "Login Fail ! User or password is not correct.", DialogIcons.Error); 
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
<asp:HyperLink ID="LoingButton" runat="server" Style="cursor: pointer">Login</asp:HyperLink>
    <DotNetAge:Dialog ID="DemoDialog" runat="server" Draggable="true" Resizable="false"
        Title="User Login" ShowModal="true" TargetID="LoingButton" OnButtonCommand="OnLoginCommand">
        <Buttons>
            <DotNetAge:DialogButton Text="Login" CommandName="Login" CommandArgument="1" />
            <DotNetAge:DialogButton Text="Cancel" OnClientClick="$(this).dialog('close')" />
        </Buttons>
        <BodyTemplate>
            <div class="dna-demo-fields">
                <ul>
                    <li>
                        <asp:Label ID="Label1" runat="server" Text="User Name"></asp:Label>
                        <asp:TextBox ID="txtUser" runat="server"></asp:TextBox></li>
                    <li>
                        <asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
                        <asp:TextBox ID="txtPwd" runat="server" TextMode="Password"></asp:TextBox></li>
                    <li>
                        <asp:CheckBox ID="cbAutoLogin" runat="server" Text="Auto Login" /></li>
                </ul>
            </div>
        </BodyTemplate>
    </DotNetAge:Dialog>
    </form>
</body>
</html>
